/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.qdu.servlet;

import com.qdu.dao.ManageActiDao;
import com.qdu.entity.Activity;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/AddActivity")
public class AddActivityServlet extends HttpServlet{

    ManageActiDao manage=new ManageActiDao();
    //记得改成post
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        
        //获得参数
        String aname=req.getParameter("aname");
        String arank=req.getParameter("arank");
        //转换成int型
        int anumber=2;
        anumber=Integer.parseInt(req.getParameter("anumber"));
        String astatus=req.getParameter("astatus");
        String acover=req.getParameter("acover");
        String adeadline=req.getParameter("adeadline");
        String astartTime=req.getParameter("astartTime");
        String aendTime=req.getParameter("aendTime");
        String aaddress=req.getParameter("aaddress");
        String atransport=req.getParameter("atransport");
        String atype=req.getParameter("atype");
        String anote=req.getParameter("anote");
        String auserId=req.getParameter("auserId");
        
        Activity activity = new Activity(auserId,acover,atype,aname,arank,anumber,adeadline,astartTime,aendTime,astatus,aaddress,atransport,anote);
        
        manage.AddActivity(activity);
        resp.sendRedirect("ManagerActiv");
    }

    
    
}
